#include<bits/stdc++.h>
using namespace std;
typedef double db;
struct cp{
	db x,y;
	cp(db xx=0,db yy=0){x=xx,y=yy;}
};
cp operator + (cp a,cp b){return cp(a.x+b.x,a.y+b.y);}
cp operator - (cp a,cp b){return cp(a.x-b.x,a.y-b.y);}
cp operator * (cp a,cp b){return cp(a.x*b.x-a.y*b.y,a.x*b.y+a.y*b.x);}
const int N=4e6+10; const db pi=acos(-1);
int r[N];
void fft(cp* a,int n,int p){
	for(int i=0;i<n;i++) if(i<r[i]) swap(a[i],a[r[i]]);
	for(int i=1;i<n;i<<=1){
		cp wn=cp(cos(pi/i),sin(pi/i)*p);
		for(int j=0;j<n;j+=(i<<1)){
			cp w=cp(1,0);
			for(int k=0;k<i;k++,w=w*wn){
				cp x=a[j+k],y=a[i+j+k]*w;
				a[j+k]=x+y; a[i+j+k]=x-y;
			}
		}
	}
}
int n,m; cp a[N],b[N];
int main()
{
	cin>>n>>m;
	for(int i=0;i<=n;i++) scanf("%lf",&a[i].x);
	for(int i=0;i<=m;i++) scanf("%lf",&b[i].x);
	int l=1,x=0;
	while(l<=n+m) l<<=1,x++;
	for(int i=0;i<l;i++) r[i]=(r[i>>1]>>1)|((i&1)<<(x-1));
	fft(a,l,1); fft(b,l,1);
	for(int i=0;i<l;i++) a[i]=a[i]*b[i];
	fft(a,l,-1);
	for(int i=0;i<=n+m;i++) printf("%d ",(int)((a[i].x)/l+0.5)); cout<<endl;
	return 0;
}
